(function ()
{
    "use strict";

    function selectDirectChildDivElementsInDivElementsWithQuerySelector()
    {
        var divElements = document.querySelectorAll('div');
        var result = [];

        for (var i = 0, len = divElements.length; i < len; i++)
        {
            var isTextNode = false;

            var child = divElements[i];
            var childNodes = child.childNodes;

            // console.log(childNodes);

            for (var j = 0; j < childNodes.length; j++)
            {
                var childNode = childNodes[j];

                if (isTextNode)
                {
                    if (childNode.nodeName === "DIV")
                    {
                        result.push(childNode);
                        isTextNode = false;
                        continue;
                    }

                    isTextNode = false;
                }
                
                if (childNode.nodeName === '#text')
                {
                    isTextNode = true;
                }
            }
        }

        return result;
    }

    function selectDirectChildDivElementsInDivElementsWithGetElementsByTagName()
    {
        var divElements = document.getElementsByTagName('div');
        var result = [];

        for (var i = 0, len = divElements.length; i < len; i++)
        {
            var isTextNode = false;

            var child = divElements[i];
            var childNodes = child.childNodes;

            // console.log(childNodes);

            for (var j = 0; j < childNodes.length; j++)
            {
                var childNode = childNodes[j];

                if (isTextNode)
                {
                    if (childNode.nodeName === "DIV")
                    {
                        result.push(childNode);
                        isTextNode = false;
                        continue;
                    }

                    isTextNode = false;
                }

                if (childNode.nodeName === '#text')
                {
                    isTextNode = true;
                }
            }
        }

        return result;
    }

    console.log(selectDirectChildDivElementsInDivElementsWithQuerySelector());
    console.log(selectDirectChildDivElementsInDivElementsWithGetElementsByTagName());
}());